<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>JSF 2: Blank Starting-Point Project</title>
	<link href="../../css/common.css" rel="stylesheet" type="text/css"></link>
	<link href="../../css/input.css" rel="stylesheet" type="text/css"></link>
	<link href="../../css/edit.css" rel="stylesheet" type="text/css"></link>
	<link href="../../css/list.css" rel="stylesheet" type="text/css"></link>
	<script type="text/javascript">
		function resetMessage1() {
			document.getElementById("settingErr").style.display = "none";
			document.getElementById("deleteErr").style.display = "none";

		}
		function resetMessage2() {
			document.getElementById("adminErr").style.display = "none";
			document.getElementById("deleteErr").style.display = "none";
		}
		function resetMessage3() {
			document.getElementById("adminErr").style.display = "none";
			document.getElementById("settingErr").style.display = "none";
		}
	</script>
	<meta content='text/html; charset=UTF-8' http-equiv="Content-Type" />
</h:head>
<h:body>
	<p:tabMenu activeIndex="8">
		<p:menuitem value="カタログ請求リスト" url="/ui/catalogclaimlist/index.jsf"
			icon="ui-icon-star" />
		<p:menuitem value="顧客情報リスト" url="/ui/users/index.jsf"
			icon="ui-icon-search" />
		<p:menuitem value="カタログマスタ管理" url="/ui/catalogs/index.jsf"
			icon="ui-icon-document" />
		<p:menuitem value="メーカー管理" url="/ui/makers/index.jsf"
			icon="ui-icon-wrench" />
		<p:menuitem value="商品管理" url="/ui/products/index.jsf"
			icon="ui-icon-wrench" />
		<p:menuitem value="展示場管理" url="/ui/places/index.jsf"
			icon="ui-icon-wrench" />
		<p:menuitem value="テーマ管理" url="/ui/themes/index.jsf"
			icon="ui-icon-wrench" />
		<p:menuitem value="テンプレート管理" url="/ui/templates/index.jsf"
			icon="ui-icon-wrench" />
		<p:menuitem value="その他管理" url="/ui/others/index.jsf"
			icon="ui-icon-wrench" />
	</p:tabMenu>
	<p:spacer height="30px"></p:spacer>

	<h:form id="claim">
		<h:outputText value="その他管理"></h:outputText>
		<f:verbatim>
			<hr style="background-color: grew"></hr>
		</f:verbatim>
		<div>

			<div>
				<h:outputText value="カタログ請求数制限設定"></h:outputText>
			</div>
			<div id="settingErr">
				<h:outputText id="settingError"
					value="#{catalogNumManagedBean.notifySetting}" escape="false"></h:outputText>
			</div>
			<!-- <p:spacer height="30px"></p:spacer> -->
			<p:panelGrid columns="2">
				<h:outputText value="請求最大カタログ数"></h:outputText>
				<p:inputText value="#{catalogNumManagedBean.catalogNum}"></p:inputText>
				<h:outputText value="各メーカーあたりの請求数"></h:outputText>
				<p:inputText value="#{catalogNumManagedBean.makerNum}"></p:inputText>
			</p:panelGrid>
			<p:spacer height="20px"></p:spacer>
			<p:commandButton value="登録"
				action="#{catalogNumManagedBean.claimSetting}" update="claim"
				onclick="resetMessage2();">
			</p:commandButton>
		</div>
	</h:form>
	<p:spacer height="30px"></p:spacer>
	<h:form id="adminlist">
		<div>
			<h:outputText value="管理者リスト"></h:outputText>
			<p:spacer height="30px"></p:spacer>
			<div id="deleteErr">
				<h:outputText value="#{loginUserManagedBean.notifyDeletion}"></h:outputText>
			</div>
			<p:dataTable id="list" value="#{loginUserManagedBean.loginUserList}"
				var="user" style="width:50%">
				<p:column headerText="ログインID">
					<h:outputText value="#{user.uname}"></h:outputText>
				</p:column>
				<p:column headerText="権限">
					<h:outputText value="#{loginUserManagedBean.roleList[user.role]}"></h:outputText>
				</p:column>
				<p:column headerText="ホストアドレス">
					<h:outputText value="#{user.ip}"></h:outputText>
				</p:column>
				<p:column headerText="変更">
					<p:commandButton value="変更"
						action="#{loginUserManagedBean.openPopUp}"
						onclick="resetMessage3();">
						<f:setPropertyActionListener
							target="#{loginUserManagedBean.selectedUser}" value="#{user}"></f:setPropertyActionListener>
					</p:commandButton>
				</p:column>
				<p:column headerText="削除">
					<p:commandButton value="削除" update=":adminlist:delete"
						oncomplete="dialog.show()" title="削除" onclick="resetMessage3();">
						<f:setPropertyActionListener
							target="#{loginUserManagedBean.selectedUser}" value="#{user}"></f:setPropertyActionListener>
					</p:commandButton>

				</p:column>
			</p:dataTable>
			<p:dialog header="削除" widgetVar="dialog" resizable="false"
				showEffect="fade" hideEffect="explode" modal="true">
				<h:panelGrid id="delete"
					style="align:center;width:400px; border: white">
					<p:row style="border:0px;">
						<p:column style="border:0px;">
							<h:outputText value="削除したデータは元に戻せません。"></h:outputText>
						</p:column>
					</p:row>
					<p:row style="border:0px white;">
						<p:column style="border:0px white;">
							<h:outputText
								value="本当に#{loginUserManagedBean.selectedUser.uname }削除しますか。"></h:outputText>
						</p:column>
					</p:row>
					<p:row style="border:0px;">
						<p:column>
							<p:commandButton id="submit" value="OK"
								style="width:130px;align:left"
								action="#{loginUserManagedBean.deleteUser}" update="adminlist"
								oncomplete="dialog.hide()">
								<f:setPropertyActionListener
									target="#{loginUserManagedBean.flag}" value="2" />
							</p:commandButton>
						</p:column>
						<p:column>
							<p:commandButton value="キャンセル" oncomplete="dialog.hide()"
								style="width:130px;align:right">
							</p:commandButton>
						</p:column>
					</p:row>
				</h:panelGrid>
			</p:dialog>
		</div>
	</h:form>
	<p:spacer height="30px"></p:spacer>
	<h:form id="admincreating">
		<div>
			<div>
				<h:outputText value="新規管理者メンバー追加"></h:outputText>
			</div>
			<p:spacer height="30px"></p:spacer>
			<div id="adminErr">
				<h:outputText id="notifyCreating"
					value="#{loginUserManagedBean.notifyCreating}" escape="false"></h:outputText>
			</div>

			<div>
				<p:panelGrid columns="2">
					<h:outputText value="ログインID"></h:outputText>
					<p:inputText value="#{loginUserManagedBean.uname}"></p:inputText>
					<h:outputText value="ログインパスワード"></h:outputText>
					<p:password value="#{loginUserManagedBean.upass1}"></p:password>
					<h:outputText value="確認パスワード"></h:outputText>
					<p:password value="#{loginUserManagedBean.upass2}"></p:password>
					<h:outputText value="権限"></h:outputText>
					<p:selectOneRadio value="#{loginUserManagedBean.role}">
						<f:selectItem itemLabel="担当者" itemValue="0"></f:selectItem>
						<f:selectItem itemLabel="管理者" itemValue="1"></f:selectItem>
					</p:selectOneRadio>
				</p:panelGrid>
				<p:spacer height="20px"></p:spacer>
				<p:commandButton value="登録" action="#{loginUserManagedBean.addUser}"
					update="admincreating, :adminlist" onclick="resetMessage1();">
					<f:setPropertyActionListener target="#{loginUserManagedBean.flag}"
						value="2" />
				</p:commandButton>
			</div>
		</div>
	</h:form>
</h:body>

</html>